<template>
  <el-timeline>
    <el-timeline-item
      v-for="item in chapterData"
      :key="item.id"
      :timestamp="item.timestamp"
      placement="top"
    >
      <el-card>
        <h4>{{ item.content }}</h4>
      </el-card>
    </el-timeline-item>
  </el-timeline>
</template>

<script setup>
import { Chapter } from '@/api/user.js'
import { onMounted, ref, watch } from 'vue'
import { watchSwitchLang } from '@/utils/i18n'
// 存储后台数据
let chapterData = ref([])
// 获取后台的数据
const getChapterData = async () => {
  chapterData.value = await Chapter()
}
// 监听语言切换
watchSwitchLang(getChapterData)
// onMounted(() => {
//   getChapterData()
// })
// watch(
//   () => chapterData,
//   () => {
//     console.log(chapterData.value)
//   },
//   { immediate: true, deep: true }
// )
</script>

<style lang="scss" scoped></style>
